#执行，可单个执行，也直接循环执行



import os
import math
import pandas as pd
from function.data_deal import stage_maxhr, compar_rr,compar_hr
from function.fun_data_deal import find_elements_with_substrings, group_by_prefix, longest_common_substring, max_hr, \
    stage_divide, df_get, compar_all
from other_function.check import check, ecg_check, singledetail_check, singlework_check, file_check, stage_check, time_check
from function.merger import merger,to_csv
from other_function.align import ecgrr_ppgrr, all_align

#测试,返回deal中的df数据
deal_path=r'D:\学习&科研\华为手表项目\华为数据\deal'
subject_path = r'D:\学习&科研\华为手表项目\华为数据\subject'
for i in range(1050,1070):
    person=str(i)
    test=person+'-1-1'
    print(test)
    # info_path=deal_path+'\\'+'stage'+'\\'+test+'-stage.csv'
    # tocsv 可直接使用,个别问题再使用problemhanding 运行一遍
    # function(subject_path,deal_path,person)
    ecg_df,rrdata_df,ppg_df,rri_df,singlework_df,singledetail_df=df_get(deal_path, person, test)
    # all_df=all_align(ecg_df,rrdata_df,ppg_df,rri_df,singlework_df,singledetail_df,person,test)

    compar_rr_result=compar_rr(ecg_df,rrdata_df,rri_df)
    compar_rr_result.function(r'D:\学习&科研\华为手表项目\华为数据\compare_rr'+'\\'+test+'compare_rr.csv',index=False)
    compar_rr_result= compar_hr(ecg_df, rrdata_df, singledetail_df)
    compar_rr_result.to_csv(r'D:\学习&科研\华为手表项目\华为数据\compare_hr'+'\\'+test+'compare_hr.csv',index=False)
    #返回deal中检查到的文件情况
    # file_info=file_check(filedir_path)


